<?php

/**
 * Vue de la fonctionnalité "lister les opérations à finaliser"
 *
 */

//no direct access
defined('_JEXEC') or die('Restricted access.');

?>

<head>
    <script src="<?php echo URL_CUSTOM_JS_LIB?>/view.js"></script>
    <link rel="stylesheet" href="/joomladev/components/com_eventbooking/assets/bootstrap/css/bootstrap.css" type="text/css" />
    <link rel="stylesheet" href="/joomladev/components/com_eventbooking/assets/css/style.css" type="text/css" />
    <link rel="stylesheet" href="/joomladev/components/com_eventbooking/assets/css/themes/default.css" type="text/css" />
    <link rel="stylesheet" href="/joomladev/components/com_eventbooking/assets/colorbox/colorbox.css" type="text/css" />
</head>

<!-- <body onload = "afterLoading();"> -->
<body>	
    <script>
            var ajaxCallbackFunction = "<?php echo (URL_AJAX_CALLBACK_FUNCTION)?>";
            var parentDivId = "s5_component_wrap";
            var gridImgsPath = "<?php echo (URL_LIB_DHTMLX_GRID_CODEBASE)?>/imgs/";
            var distributionGrid;
            //beforeLoading();
    </script>            


    <!-- Contenu -->
    <div style="display:inline-block;"><img src="<?php echo (URL_IMAGES_PANECO_PATH)?>/finalisation.png" alt="Finalisation" style="width:64px;height:64px"></div>
    <div style="display:inline-block;"><h1><?php echo $titrePage; ?></h1></div><br><br>
    
    <?php
       
    //liste des familles de produit
    $familles = AmapHelper::getProductsFamilies();
    foreach ($familles as $famille) {        
        $codeFamilleLu = $famille['code'];
        $operationsFamilleLue =  AmapHelper::getOperations($codeFamilleLu, true, 'afinaliser')        
    ?>
    
    <div id="eb-categories">
        <div class="eb-box-heading">
            <h3 class="eb-category-title" style="font-weight: bold;">
                <?php echo $famille['libelle'] ?>&nbsp;&nbsp;<small> <?php echo count($operationsFamilleLue) ?> Opération(s) à finaliser</small>
            </h3>
        </div>
        <div style="margin-left: 20px;">
            <table class="table table-striped table-bordered table-condensed">
                <!--
                <thead>
                    <tr>
                        <th>Opération</th>							
                        <th class="date_col" style="width:40%;">Date de fin de souscription</th>							
                    </tr>
                </thead>
                -->
                <tbody>                    
                    
                    <?php                    
                    //boucle sur chaque opératon trouvée
                    foreach ($operationsFamilleLue as $operation) {
                    ?>
                                        
                    <tr>
                        <td style="width:60%;"><a href="<?php echo URL_FINALISER_OPERATION.'?libelle-operation='.$operation['libelle'].'&'.ECaracObjet::ECaracObjetCodeFamilleProduit.'='.$famille['code'].'&'.ECaracObjet::ECaracObjetCodeOperation.'='.$operation['code']?>" class="eb-event-link"><?php echo $operation['libelle']?></a></td>					
                        <td style="width:40%;">A finaliser avant le : <?php echo $operation['datedebutoperation']?> </td>                        
                    </tr>
                    
                    <?php } ?>
                    
                </tbody>
            </table>
        </div>
    </div>

    <?php } ?>
</body>